package org.wenhuayuan.library.log;

import androidx.annotation.NonNull;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class HiLogManager {
    private HiLogConfig hiLogConfig;
    private static HiLogManager instance;
    private List<HiLogPrinter> printers = new ArrayList<>();
    private HiLogManager(HiLogConfig hiLogConfig, HiLogPrinter[] printers) {
        this.hiLogConfig = hiLogConfig;
        this.printers.addAll(Arrays.asList(printers));
    }
    public static HiLogManager getInstance() {
        return instance;
    }
    public HiLogConfig getHiLogConfig() {
        return hiLogConfig;
    }

    public static void init(@NonNull HiLogConfig hiLogConfig, HiLogPrinter... printers) {
        instance = new HiLogManager(hiLogConfig, printers);
    }

    public void addPrinter(HiLogPrinter printer) {
        printers.add(printer);
    }
    public List<HiLogPrinter> getPrinters(){
        return printers;
    }
    public void removePrinter(HiLogPrinter printer) {
        if (printers != null) {
            printers.remove(printer);
        }
    }
}
